package com.siao.component
{
	import flash.events.Event;
	
	[Event(name="change", type="flash.events.Event")]
	
	/**
	 * 复选框
	 * @author SiaoLeon
	 */
	public class CheckBox extends StateButton implements ISelectItem
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		private var _selected:Boolean;
		
		/**
		 * 是否选中
		 * @return
		 */
		public function get selected():Boolean
		{
			return this._selected;
		}
		
		public function set selected(value:Boolean):void
		{
			this._selected = value;
			
			this.updateState();
			
			this.dispatchEvent(new Event(Event.CHANGE));
		}
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function CheckBox()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		// -------------------------------------------------------------------------------------------------------- 函数
		
		override protected function onMouseClick():void
		{
			this.selected = !this.selected;
		}
	
	}
}
